package lab02.Test19;

/**
 * Created by tanfei on 2017/11/1.
 */
public class Test {
    public static void main(String[] args) {
        String a="HelloWord";
        StringBuffer aa=convertString (a);
        System.out.println("大小写转换后是："+convertString(a));
        System.out.println("倒叙输出后是："+aa.reverse());}

    public static   StringBuffer convertString(String str) {
        String upStr=str.toUpperCase();
        String lowStr=str.toLowerCase();
        StringBuffer buf =new StringBuffer(str.length());
        for (int i=0;i<=8;i++)
        {
            if(str.charAt(i)==upStr.charAt(i)){
                buf.append(lowStr.charAt(i));
            }else{
                buf.append(upStr.charAt(i));
            }
        }

        return buf;

    }

}
